/**
 * Created by shaofuwen on 2018/2/23.
 */

import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import actions from './../actions';


const options = {
    withRef: true
};


export default function connectComponent({ mapStateToProps, mapDispatchToProps, mergeProps, LayoutComponent }) {
    return connect(
        mapStateToProps || function (state) {
            return {
                routes: state.routes
            };
        },
        mapDispatchToProps || function (dispatch) {
            return {
                actions: bindActionCreators(actions, dispatch)
            }
        },
        mergeProps,
        options
    )(LayoutComponent);
}